<template>
    <el-dialog :visible.sync="visible" v-dialogDrag :title="title" :close-on-click-modal="false" class="tl-dialog" width="900px" @open="open" @close="close">
        <el-form class="tl-form" ref="form" :model="model" :rules="rules" label-width="150px">
            <el-row>
                <el-col :span="12">
                    <el-form-item label="字段编码" prop="code" :rules="rules.validateRequire">
                        <el-input v-model="model.code" :disabled="!(user.adminlevel===9)"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="名称" prop="name" :rules="rules.validateRequire">
                        <el-input v-model="model.name"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="12">
                    <el-form-item label="页面编码" prop="pagecode" :rules="rules.validateRequire">
                        <el-input v-model="model.disppagecode" :disabled="true" class="tl-ref-selector" :class="{disabled:!(user.adminlevel===9)?true:false}">
                            <el-button slot="append" type="primary" icon="el-icon-search" @click="openMisVuePageInfoRefDialog" v-if="!disableEditSubmit" :disabled="!(user.adminlevel===9)"></el-button>
                        </el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="是否必填" prop="required">
                        <!-- <el-input v-model="model.required"></el-input> -->
                        <el-select v-model="model.required" placeholder="请选择">
                            <el-option v-for="item in codeModel.pageFieldIsRequiredList" :key="item.code" :label="item.name" :value="item.code" />
                        </el-select>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>

            </el-row>
            <el-row>
                <el-col :span="24">
                    <el-form-item label="提示文字" prop="placeholder">
                        <el-input v-model="model.placeholder" type="textarea" :rows="2"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="24">
                    <el-form-item label="默认值" prop="defaultvalue">
                        <el-input v-model="model.defaultvalue" type="textarea" :rows="2"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="24">
                    <el-form-item label="备注" prop="description">
                        <el-input v-model="model.description" type="textarea" :rows="2"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>

        </el-form>
        <div slot="footer" class="dialog-footer">
            <el-button :type="disableEditSubmit === false ? 'text' : 'primary'" @click="doCancelEdit">取消</el-button>
            <el-button type="primary" @click="doSubmitEdit" :loading="saveLoading" v-if="disableEditSubmit === false">确认</el-button>
        </div>
        <page-ref ref="pageRef" @confirm="getMisVuePageInfoRefData" :isSingleSelect="true"></page-ref>
    </el-dialog>
</template>

<script>
/** mixins */
import { mixin_edit } from '@tapui/mixins/mixin_edit'
import pageRef from '../misVuePageInfo/refList'
/** 子组件 */
/** 工具类 */
import { putAction, getAction, postAction, deleteAction } from '@tapui/utils/http'
/** VUE配置 */
export default {
    mixins: [mixin_edit],
    components: { pageRef },
    data() {
        return {
            moduleTitle: '前端Vue页面字段信息表',
            urlPrefix: '/mis/vuePageFieldInfo/',
            url: {
                // 额外的url
            }
        }
    },
    methods: {
        loaded() {
        },
        /** 打开VUE页面信息参照 */
        openMisVuePageInfoRefDialog() {
            this.$refs.pageRef.visible = true
        },
        /** 获取VUE页面信息参数数据 */
        getMisVuePageInfoRefData(selectionRow, selectKey, selectionValue) {
            this.$set(this.model, 'pagecode', selectionRow.code)
            this.$set(this.model, 'disppagecode', selectionRow.name)
        }
    }
}
</script>

